import React,{useEffect,useState} from 'react'
import * as api from './server'
import './header.css'

const Collection = () => {

    const [list,setList]=useState([]);
    useEffect(()=>{
        api.getCollect('HL1115')
        .then(res=>{
            // console.log(res.data)
            setList(res.data)
        })
    },[])

  return (
    <div>
        <h2>您收藏的数量为：{list.length}</h2>
        {
            list.map(item=>{
                return <li className='item' key={item.id}>{item.content}</li>
            })
        }
    </div>
  )
}

export default Collection